﻿<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE HTML>
<html>
<head>
<%@include file="/common/taglibs.jsp" %>
<meta charset="utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<LINK rel="Bookmark" href="/favicon.ico" >
<LINK rel="Shortcut Icon" href="/favicon.ico" />
<%@include file="/common/css.jsp"%>
<link href="${ctx }/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">
<title>H-ui.admin v2.3</title>
<meta name="keywords" content="H-ui.admin v2.3,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
<meta name="description" content="H-ui.admin v2.3，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
</head>
<body>
<%@include file="/common/top.jsp" %>
<%@include file="/common/menu.jsp" %>
<section class="Hui-article-box">
<nav class="breadcrumb">
	<i class="Hui-iconfont"></i>
	<a href="/" class="maincolor">首页</a>
	<span class="c-999 en">&gt;</span>基础
	<span class="c-999 en">&gt;</span>
	<span class="c-666">表格</span>
</nav>
<div class="Hui-article">
	<div class="cl pd-20">
		<div class="text-c">
		<form id="formsearch" action="${ctx }/res/gotoResourceView" method="post">
			<input type="hidden" name="pageNo" value="${page.pageNo }" />
			<input type="text" name="searchKey" id="search_key" value="${param.searchKey}" placeholder="所属类、所调方法" style="width:250px" class="input-text">
			<button type="submit" id="search_resource" class="btn btn-secondary" ><i class="Hui-iconfont">&#xe665;</i>查询</button>
		</form>
		</div>
		<div class="mt-20">
			<a class="btn btn-primary size-S" id="refreshResource">刷新资源</a>
			<table class="table table-border table-bordered table-hover table-bg">
				<thead>
					<tr class="text-c">
						<th width="50">序列</th>
						<th width="180">所属类</th>
						<th width="180">所调方法</th>
						<th width="280">URL</th>
						<th width="100">资源类型</th>
						<th width="100">权限类型</th>
						<th width="100">状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
				<c:forEach items="${page.data }" var="res" varStatus="status">
					<tr class="text-c">
						<td>${status.index+1}</td>
						<td>${res.action }</td>
						<td>${res.method }</td>
						<td>${res.url }</td>
						<td>${res.chineseType}</td>
						<td>${res.chineseAuthType }</td>
						<td>${res.chineseStatus }</td>
						<td class="f-14">
							<div class="dropDown dropDown_click">
								<a class="btn btn-link size-MINI" href="#">操作</a>
								<div class="dropDown-menu box-shadow">
								  	<input type="hidden" name="resourceId" value="${res.id }" />
								  	<input type="hidden" name="authType" value="${res.authType }" />
								    <ul>
										<shiro:hasPermission name="startAccess">
											<c:if test="${res.status !=1}">
												<li><a href="#" name="start_btn" data-id="${res.id}">启用</a></li>
											</c:if>
										</shiro:hasPermission>
										<shiro:hasPermission name="stopAccess">
											<c:if test="${res.status !='2' and res.status !='3'}">
												<li><a href="#" name="stop_btn" data-id="${res.id}">停用</a></li>
											</c:if>
										</shiro:hasPermission>
										<shiro:hasPermission name="delResource">
											<c:if test="${res.status !='3'}">
									  			<li><a href="#" name="delete_btn" data-id="${res.id}">删除</a></li>
											</c:if>
										</shiro:hasPermission>
										<shiro:hasPermission name="authConstraint">
									  		<li><a href="#" name="auth_config_btn" data-id="${res.id}" data-authType="${res.authType}">权限约束</a></li>
										</shiro:hasPermission>
								    </ul>
								</div>
							</div>
						</td>
					</tr>
				</c:forEach>
				</tbody>
			</table>
			<div id="page_div" class="text-c mt-5"></div>
		</div>
	</div>
</div>
</section>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
	<div class="modal-header">
		<h5><span></span></h5>
		<a class="close" data-dismiss="modal" aria-hidden="true">
			<i class="Hui-iconfont">&#xe6a6;</i>
		</a>
	</div>
	<div class="modal-body">
		<%--访问约束 --%>
		<div id="access_constraint" class="text-c">
			<form action="${ctx }/res/updateRole" method="post" class="form form-horizontal">
					<div class="row cl">
						<label class="form-label col-3">频率约束(毫秒)：</label>
						<div class="formControls col-5">
							<input type="text" class="input-text" autocomplete="off" placeholder="1-10个字符" name="roleName" id="role-roleName">
						</div>
						<div class="col-4"> </div>
					</div>
					<div class="row cl">
						<label class="form-label col-3">IP约束：</label>
						<div class="formControls col-5">
							<textarea class="textarea radius" id="role-remark" name="remark"  rows="" cols=""></textarea>
						</div>
						<div class="col-4"> </div>
					</div>
					<div class="row cl">
						<label class="form-label col-3">key约束：</label>
						<div class="formControls col-5">
							<textarea class="textarea radius" id="role-remark" name="remark"  rows="" cols=""></textarea>
						</div>
						<div class="col-4"> </div>
					</div>
			</form>
		</div>
		<%--权限控制 --%>
		<div id="auth_form"class="text-c">
			<form action="${ctx }/res/saveAuthType" method="post" class="form form-horizontal">
				<input type="hidden" name="resourceId" id="resourceId" />
					<div class="row cl skin-minimal" >
						<label class="form-label col-3">控制类型：</label>
						<div class="formControls col-8">
							<div class="radio-box"><input type="radio" name="authType" id="auth-def" value="def"/><label for="auth-def">私有</label></div>
							<div class="radio-box"><input type="radio" name="authType" id="auth-login" value="login"/><label for="auth-login">登陆</label></div>
							<div class="radio-box"><input type="radio" name="authType" id="auth-anon" value="anon"/> <label for="auth-anon">匿名</label></div>
							<div><span class="text-c c-red f-12">注：默认类型是跟着用户所拥有的菜单权限来控制</span></div>
						</div>
					</div>
					<div class="row cl">
						<div class="col-6 col-offset-3">
							<label class="form-label col-3"></label>
							<ul id="role-tree" class="ztree" style="display:none">
							</ul>
						</div>
					</div>
			</form>
		</div>
	</div>
	<div class="modal-footer">
		<div id="auth_form_btn">
			<a class="btn btn-primary" id="saveAuthBtn">保存</a>
		</div>
	</div>
</div>
<%@include file="/common/js.jsp"%>
<script type="text/javascript" src="${ctx }/js/page.js"></script>
<script type="text/javascript" src="${ctx }/lib/zTree/v3/js/jquery.ztree.all-3.5.js"></script>
<script type="text/javascript" src="${ctx }/js/sys_resource.js"></script>
<script type="text/javascript">
Page.page(${page.pageNo},${page.pageSize},${page.totalCount},"formsearch");
</script>
</body>
</html>